-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a module not found error instead of assertion error #1
Conversation
I would rather change |
I agree, The changes are on this PR - sindresorhus/resolve-from#4 |
resolve-from@3 is out. Can you update this PR? |
You also need to fix the merge conflict. |
Updated, thanks for the quick response ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also rename fn
to m
in the tests?
test.js
Outdated
@@ -1,9 +1,17 @@ | |||
import test from 'ava'; | |||
import fn from './'; | |||
|
|||
test(t => { | |||
test('reqFrom', t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reqFrom()
test.js
Outdated
t.is(moduleNotFoundError.message, 'Cannot find module \'./nonexistent\''); | ||
}); | ||
|
||
test('reqFrom,silent', t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reqFrom.silent()
Thank you @ranyitz :) |
No problem, Thank you @sindresorhus @SamVerschueren :) |
If the module wasn't found,
req-from
is throwing an assertion error, this is because resolve-from is returningnull
in case the module wasn't found.The PR will throw a
module not found
like error, with the same code and message.another option would be to extend
resolve-from
in order to get the original error if that's a better solution.